﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OverStore.Runtime.ObjectRepository.Reader
{
    /// <summary>
    /// Base interface for readers.
    /// </summary>
    /// <typeparam name="TInstance">The type of the instance.</typeparam>
    /// <typeparam name="TItemIdentifier">The type of the item identifier.</typeparam>
    public interface IReader<TInstance, TItemIdentifier> : IRuntimeComponent
        where TInstance : class
    {
        /// <summary>
        /// Gets the type of the parameter for reader or null if reader does not expect any parameter.
        /// </summary>
        /// <value>The type of the parameter.</value>
        Type ParameterType { get; }

        /// <summary>
        /// Executes the reader with specified parameters. <paramref name="parameter"/> may be null
        /// if implementation supports it.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <returns></returns>
        IEnumerable<TInstance> ExecuteReader(Object parameter);
    }
}
